<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-do-edit" th:object="${tbKnowledge}">
        <input type="hidden" name="knowledgeId" th:value="*{knowledgeId}"><!-- 主键 -->
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="title" th:value="*{title}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="content" th:value="*{content}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="picPath" th:value="*{picPath}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">发布者名字:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="ownName" th:value="*{ownName}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="updateTime" th:value="*{updateTime}"></div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    layui.use('laydate', function () {
        var laydate = layui.laydate;//时间选择器
        laydate.render({
            elem: '#inDate', type: 'date'
        });
    });
    var prefix = "/tbKnowledge"
    $("#form-do-edit").validate({
        rules: {
            knowledgeId: {required: true},
        },
        messages: {
            "knowledgeId": {remote: "必填"}
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/editSave", dataEdit());
        }
    });

    function dataEdit() {
        var knowledgeId = $("input[name='knowledgeId']").val();
        var title = $("input[name='title']").val();
        var content = $("input[name='content']").val();
        var picPath = $("input[name='picPath']").val();
        var ownName = $("input[name='ownName']").val();
        var createTime = $("input[name='createTime']").val();
        var updateTime = $("input[name='updateTime']").val();
        return {
            "knowledgeId":knowledgeId,
            "title":title,
            "content":content,
            "picPath":picPath,
            "ownName":ownName,
            "createTime":createTime,
            "updateTime":updateTime,
        }
    }
</script>
</body>
</html>